<tagLib name="fanwe" />
<include file="Public:header" />
<script type="text/javascript" src="__TMPL__Static/Js/dataList.js"></script>
<div class="handle-btns">
	<fanwe:imageBtn id="editData" name="editData" value="{$Think.lang.EDIT}" click="editData(this,'checkList')" />
	<fanwe:imageBtn id="removeGoods" name="removeGoods" value="{$Think.lang.REMOVE}" click="removeGoods(this,'checkList')" />
	<fanwe:imageBtn id="disableGoods" name="disableGoods" value="{$Think.lang.DISABLE}" click="disableGoods(this,'checkList')" />
	<form action="__APP__">
		<span>{$Think.lang.KEYID}</span>
		<input class="textinput" type="text" value="{$keyid}" name="keyid" size="10" />
		<small></small>
		<span>{$Think.lang.NAME}</span>
		<input class="textinput" type="text" value="{$keyword}" name="keyword" size="10" />
		<small></small>
		<span>{$Think.lang.COLOR}</span>
		<select name="color">
			<option value="0">{$Think.lang.COLOR_ALL}</option>
			<foreach name="color_list" item="color_item">
			<option value="{$color_item.id}" <if condition="$color eq $color_item['id']">selected="selected"</if> >{$color_item.name}</option>
			</foreach>
		</select>
		<small></small>
		<span>{$Think.lang.CATE_NAME}</span>
		<select name="cate_id">
			<option value="0" <if condition="$cate_id eq 0">selected="selected"</if> >{$Think.lang.GOODS_ALL}</option>
			<option value="-1" <if condition="$cate_id eq -1">selected="selected"</if> >{$Think.lang.NO_CATEGORY}</option>
			<foreach name="cate_list" item="cate_item">
			<option value="{$cate_item.cate_id}" <if condition="$cate_id eq $cate_item['cate_id']">selected="selected"</if> >{$cate_item.cate_name}</option>
			</foreach>
		</select>
		<input class="submit_btn" type="submit" value="{$Think.lang.SEARCH}" />
		<input type="hidden" name="{:c('VAR_MODULE')}" value="{$module_name}" />
		<input type="hidden" name="{:c('VAR_ACTION')}" value="index" />
	</form>
</div>
<fanwe:list 
	id="checkList" 
	style="list" 
	name="item" 
	checkbox="true" 
	action="true" 
	datasource="list" 
	show="keyid:{$Think.lang.KEYID}|160,img_id|getTooltipImg:{$Think.lang.IMG_ID}|50,cate_name:{$Think.lang.CATE_NAME}|80,color_name:{$Think.lang.COLOR}|60,name|getGoodsNameLink=$item['url']:{$Think.lang.NAME}|~left,price:{$Think.lang.PRICE}|80" 
	actionlist="disableGoods:{$Think.lang.DISABLE}:id,editData:{$Think.lang.EDIT}:id,removeGoods:{$Think.lang.REMOVE}:id" action_width="160" nosort="cate_name,name,url,price" />
<div class="pager">{$page}</div>
<script type="text/javascript">
var CONFIRM_HANDLER = "{$Think.lang.CONFIRM_HANDLER}";
function disableGoods(obj,id,pk,args)
{
	removeDisableGoods(obj,id,1);
}

function removeGoods(obj,id,pk,args)
{
	removeDisableGoods(obj,id,0);
}

function removeDisableGoods(obj,id,type)
{
	var ids =  new Array();
	if(isNaN(id))
	{
		$("#" + id + " input:checked[name='key']").each(function(){
			ids.push(this.value);
		});
	}
	else
	{
		ids.push(id);
		var parent = $(obj).parent().parent();
		id = parent.parent().parent().attr('id');
	}
	
	ids = ids.join(',');
	if(ids == '')
		return false;
	
	if(!window.confirm(CONFIRM_HANDLER))
		return false;
		
	var fun = function(){
		if(type == 1)
			location.href = APP + '?' + VAR_MODULE + '=' + CURR_MODULE + '&' + VAR_ACTION + '=disable&id=' + ids;
		else
			location.href = APP + '?' + VAR_MODULE + '=' + CURR_MODULE + '&' + VAR_ACTION + '=remove&id=' + ids;
	}
	setTimeout(fun,1);
}
</script>
<include file="Public:footer" />